//
//
//
//
//

#include <iostream>
#include <string>
#include "Parser.h"
#include "LogManager.h"
#include "Exception.h"
#include "StrUtil.h"

int main(int argc, char** argv)
{
	LogManager::Instance()->UseAdapter(LogManager::STDOUT_ADAPTER_TYPE);
	LogManager::Instance()->LogLevel(LogManager::TRACE);

	try
	{
		TinyXML::Parser _parser("./test.xml");
		_parser.Parse();
		_parser.WriteToFile("./write.xml");

		/*
		std::string name = "weblogic-web-app:container-descriptor:prefer-web-inf-classes";
		std::string context = "";
		//_parser.GetNodeContent(name, context);
		//_parser.GetNodeContent("weblogic-web-app:container-descriptor:test1", context);
		//_parser.GetNodeContent("weblogic-web-app:container-descriptor:test2:test3", context);
		//_parser.GetNodeContent("weblogic-web-app:container-descriptor:test4:test5", context);

		//_parser.GetRoot()->GetName() = "======================";

		std::cout << "---Convert" << Util::StrConvert("0") << std::endl;
		std::cout << "---Convert" << Util::StrConvert("1") << std::endl;
		std::cout << "---Convert" << Util::StrConvert("0.09") << std::endl;
		std::cout << "---Convert" << Util::StrConvert("1.091111") << std::endl;
		std::cout << "---Convert" << Util::StrConvert(".091111") << std::endl;
		std::cout << "---Convert" << Util::StrConvert("009098.091111") << std::endl;
		std::cout << "---Convert" << Util::StrConvert("09090") << std::endl;
		std::cout << "---Convert" << Util::StrConvert("4294967295") << std::endl;
		std::cout << "---Convert" << Util::StrConvert("2147483647") << std::endl;
		std::cout << "---Convert" << Util::StrConvert("2147483648") << std::endl;

		std::cout << sizeof(int) << std::endl;
		std::cout << sizeof(long) << std::endl;
		std::cout << sizeof(double) << std::endl;
		std::cout << sizeof(char*) << std::endl;
		std::cout << sizeof(int*) << std::endl;
		*/
	}
	catch(const Exception& exp)
	{
		LOGERROR(exp.What());
	}
	catch(...)
	{
		LOGERROR("Unknow exception");
		return -1;
	}
	return 0;
}
